package org.fireflow2.designer.eclipse.parts.tree;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;

import org.eclipse.gef.editparts.AbstractTreeEditPart;
import org.fireflow2.designer.eclipse.modelwrapper.SubProcessWrapper;


public class SubflowTreePart extends AbstractTreeEditPart  implements PropertyChangeListener {
    protected List getModelChildren() {
        return ((SubProcessWrapper) getModel()).getAllNodes4OutlineView();
    }
    
    public void activate() {
        super.activate();
        ((SubProcessWrapper) getModel()).addPropertyChangeListener(this);
    }

    public void deactivate() {
        super.deactivate();
        ((SubProcessWrapper) getModel()).removePropertyChangeListener(this);
    }

    public void propertyChange(PropertyChangeEvent evt) {
        String prop = evt.getPropertyName();
        if (SubProcessWrapper.NODE.equals(prop))
            refreshChildren();
    }	    
}
